const axios = require('axios');
const fs = require('fs');
async function getTextEmbedding(text){
    const token = 'sk-ydzqkkiwntyhpwkoqecipbcqfiuzhwopqfqaxmteuhbnpgbu';
    const options = {
        headers: {
            Authorization: 'Bearer '+token,
             'Content-Type': 'application/json'},
    };
    //请求的url地址
    const url = 'https://api.siliconflow.cn/v1/embeddings';
    //请求体
    const body = {
        "model":"BAAI/bge-large-zh-v1.5",
        "input":text,
        "encoding_format":"float"
    }
    const response = await axios.post(url,body,options);
    const embedding = response.data.data[0].embedding;
    return embedding;
}
module.exports =getTextEmbedding;